package main

import "fmt"

var m = [][]byte{
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
	[]byte("************"),
}

const MaxAns = 10005

var (
	cx, cy, fx, fy     = 0, 0, 0, 0
	cdx, cdy, fdx, fdy = 0, -1, 0, -1
)

func main() {
	var (
		ans = 0
	)
	for i := 1; i <= 10; i++ {
		line := ""
		fmt.Scanln(&line)
		for j := 1; j <= 10; j++ {
			if line[j-1] == 'C' {
				cx, cy = j, i
			} else if line[j-1] == 'F' {
				fx, fy = j, i
			}
			m[i][j] = line[j-1]
		}
	}
	for {
		if step() {
			ans++
			if ans >= MaxAns {
				fmt.Print(0)
				break
			}
			continue
		}
		fmt.Print(ans)
		break
	}
}

func rollC() {
	// 旋转矩阵
	// ｜ 0 -1 ｜｜dx｜
	// ｜ 1  0 ｜｜dy｜
	// (-dy, dx)
	cdx, cdy = -cdy, cdx
}

func rollF() {
	fdx, fdy = -fdy, fdx
}

func step() bool {
	if cx == fx && cy == fy {
		return false
	}
	if m[cy+cdy][cx+cdx] == '*' {
		rollC()
	} else {
		cy += cdy
		cx += cdx
	}

	if m[fy+fdy][fx+fdx] == '*' {
		rollF()
	} else {
		fy += fdy
		fx += fdx
	}
	return true
}
